package com.authine.cloudpivot.ext.service;

import com.alibaba.cola.dto.SingleResponse;
import com.authine.cloudpivot.ext.dto.transfer.MemberPurchaseOrderDto;
import com.authine.cloudpivot.ext.dto.transfer.PurchaseInvoiceDto;
import com.authine.cloudpivot.ext.dto.transfer.PurchaseOrderReturnDto;
import com.authine.cloudpivot.ext.dto.transfer.PurchaseRequestPaymentDto;
import com.authine.mvp.app.launcher.dto.bo.response.BO;

import java.util.List;

/**
 * 订单服务接口
 */

public interface TransferOrderService {
    /**
     * 生成采购订单
     *
     * @param dto 转采订单
     *            cn/gomro/core/bizes/purchase/management/service/impl/PurchaseOrderService.save
     * @return
     */
    SingleResponse<BO> submitTransferOrder(MemberPurchaseOrderDto dto) throws RuntimeException;

    /**
     * 修改采购订单
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseOrderService.update
     *
     * @param mbp
     * @return
     * @throws RuntimeException
     */
    SingleResponse<BO> editPurchaseOrder(MemberPurchaseOrderDto mbp) throws RuntimeException;

    /**
     * 分配采购员
     *
     * @param transferOrderGoodsIds 转采商品id
     *  cn/gomro/core/bizes/purchase/management/service/impl/TransferOrderService.updatePurchaseAgent
     * @return
     * @parem purchaseAgentId 采购员id
     */
    boolean updatePurchaseAgent(List<String> transferOrderGoodsIds, String purchaseAgentId) throws RuntimeException;

    /**
     * 返回待采以及标记已采购
     *
     * @param transferOrderGoodsIds
     * @param notPurchaseFlag
     * @param reason
     * @return
     * @throws RuntimeException
     */
    boolean tagPurchaseGoods(List<String> transferOrderGoodsIds, String notPurchaseFlag, String reason) throws RuntimeException;

    /**
     * 采购订单审核通过
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseOrderService.approvePurchaseOrder
     *
     * @param memberPurchaseOrderIds
     */
    SingleResponse<BO> approvePurchaseOrder(List<String> memberPurchaseOrderIds);

    /**
     * 采购订单审核驳回
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseOrderService.disapprovePurchaseOrder
     */
    boolean disapprovePurchaseOrder(List<String> memberPurchaseOrderIds) throws RuntimeException;

    /**
     * 提交申请付款
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseFinanceService.save
     *
     * @return
     */
    SingleResponse<BO> savePurchaseRequestPayment(PurchaseRequestPaymentDto dto);

    /**
     * 采购收票保存
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseFinanceService.savePurchaseInvoice
     *
     * @param purchaseInvoice
     * @return
     */
    SingleResponse<BO> submitPurchaseOrder(PurchaseInvoiceDto purchaseInvoice);

    /**
     * 创建退货单
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseOrderService.refund
     */
    SingleResponse<BO> createMemberPurchaseOrderRefund(MemberPurchaseOrderDto dto);

    /**
     * 付款单审核
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseFinanceService.approvePurchaseRequestPayment
     *
     * @param dto
     * @return
     */
    Boolean approvePurchaseRequestPayment(PurchaseRequestPaymentDto dto);

    /**
     * 采购付款作废
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseFinanceService.abandonPayment
     */
    boolean abandonPayment(List<String> ids) throws RuntimeException;

    /**
     * 转采修改发票明细
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseFinanceService.updatePurchaseInvoice
     *
     * @param dto
     */
    SingleResponse<BO> updatePurchaseInvoice(PurchaseInvoiceDto dto);

    /**
     * 取消收票或 财务确认收票
     */
    boolean invoiceCancelOrConfirm(List<String> idList, String type, String addFinancialInvoiceTime) throws RuntimeException;

    /**
     * 采购单作废
     * cn/gomro/core/bizes/purchase/management/service/impl/PurchaseOrderService.purchaseReturn
     *
     * @param ids
     * @return
     */
    boolean purchaseReturn(List<String> ids, Integer type);

    /**
     * 通过采购订单ID查询采购订单商品数据
     * @param dto
     * @return
     */
    SingleResponse purchaseGoodsFindByPurchase(MemberPurchaseOrderDto dto);

    /**
     * 根据云平台订单商品号,查询转采供应商和RP采购单号，供应商，退款金额
     * @param orderGoodsId
     * @return
     */
    List<PurchaseOrderReturnDto> getPurchaseReturnInfo(String orderGoodsId);
}
